#ifndef __pbc_h__
#define __pbc_h__ 

#include <stdint.h>
#include <stdio.h>

#define WIRETYPE_VARINT 0
#define WIRETYPE_LENGTH 2
#define WIRETYPE_FIXED32 5

#define INIT_SIZE 8
#define NAME_SIZE 64


#define DECORATE_OPTIONAL 1
#define DECORATE_REPEATED 2
#define DECORATE_REQUIRED 3

#define PBC_UNKNOW  -1
#define PBC_INT32   1
#define PBC_INT64   2
#define PBC_SINT32  3
#define PBC_SINT64  4
#define PBC_STRING  5
#define PBC_MESSAGE 6
#define PBC_FLOAT   7
#define PBC_DOUBLE  8

typedef unsigned char byte;


struct hashmap;
struct pbc_proto;
struct pbc_rmessage;

struct pbc_field
{
    int field_number;
    int wire_type;
    int dec_type;
    char name[NAME_SIZE];
    struct pbc_field *next;
    struct pbc_env *m;
};

struct pbc_env
{
    char name[NAME_SIZE];
    struct pbc_field *header;
    int field_sz;
    int array_sz;
};

struct pbc_userdef
{
    char name[NAME_SIZE];
    struct pbc_field *f;
};

struct pbc
{
    int cap;
    int idx;
    struct pbc_userdef *userdef;
    struct hashmap *msgs;
};


struct chumk
{
    int len;
    uint8_t *buffer;
};

#include "parser.h"
#include "proto.h"

#endif

